= render ::Layouts::SettingsBlockComponent.new(_('Default branch'),
  id: 'js-default-branch-name',
  expanded: expanded_by_default?) do |c|
  - c.with_description do
    = s_('GroupSettings|Set the initial name and protections for the default branch of new repositories created in the group.')
  - c.with_body do
    = gitlab_ui_form_for @group, url: group_path(@group, anchor: 'js-default-branch-name'), html: { class: 'fieldset-form' } do |f|
      = form_errors(@group)
      - fallback_branch_name = "<code>#{Gitlab::DefaultBranch.value(object: @group)}</code>"

      %fieldset
        .form-group
          = f.label :default_branch_name, _('Initial default branch name'), class: 'label-light'
          = f.text_field :default_branch_name, value: group.namespace_settings&.default_branch_name, placeholder: Gitlab::DefaultBranch.value(object: @group), class: 'form-control'
          %span.form-text.gl-text-subtle
            = (s_("GroupSettings|If not specified at the group or instance level, the default is %{default_initial_branch_name}. Does not affect existing repositories.") % { default_initial_branch_name: fallback_branch_name }).html_safe

          = render 'groups/settings/default_branch_protection_defaults', f: f, group: @group

        = f.hidden_field :redirect_target, value: "repository_settings"
        = f.submit _('Save changes'), pajamas_button: true
